﻿using System.Collections.Generic;
using System.Text;

namespace STT.Parser
{
    // Token: 0x02000029 RID: 41
    public class Array_Format
    {
        // Token: 0x060000D5 RID: 213 RVA: 0x0000909D File Offset: 0x0000809D
        public Array_Format()
        {
            this.array_format = new List<StringBuilder[]>();
            this.NewLine();
        }

        // Token: 0x060000D6 RID: 214 RVA: 0x000090B8 File Offset: 0x000080B8
        private void NewLine()
        {
            this.current_line = new StringBuilder[3];
            this.current_line[0] = new StringBuilder();
            this.current_line[1] = new StringBuilder();
            this.current_line[2] = new StringBuilder();
            this.array_format.Add(this.current_line);
        }

        // Token: 0x060000D7 RID: 215 RVA: 0x0000910C File Offset: 0x0000810C
        public void Indent(uint level)
        {
            uint num = 0U;
            while (num++ < level)
            {
                this.Add("    ");
            }
        }

        // Token: 0x060000D8 RID: 216 RVA: 0x00009130 File Offset: 0x00008130
        public void Add(StringBuilder sb)
        {
            this.current_line[1].Append(sb);
        }

        // Token: 0x060000D9 RID: 217 RVA: 0x00009141 File Offset: 0x00008141
        public void AddLine(StringBuilder sb)
        {
            this.Add(sb);
            this.NewLine();
        }

        // Token: 0x060000DA RID: 218 RVA: 0x00009150 File Offset: 0x00008150
        public void Add(string s)
        {
            this.current_line[1].Append(s);
        }

        // Token: 0x060000DB RID: 219 RVA: 0x00009161 File Offset: 0x00008161
        public void AddLine(string s)
        {
            this.Add(s);
            this.NewLine();
        }

        // Token: 0x060000DC RID: 220 RVA: 0x00009170 File Offset: 0x00008170
        public void AddEnd(string s)
        {
            StringBuilder stringBuilder = this.current_line[2];
            stringBuilder.Append(s);
        }

        // Token: 0x060000DD RID: 221 RVA: 0x0000918E File Offset: 0x0000818E
        public void AddEndAndNewLine(string s)
        {
            this.AddEnd(s);
            this.NewLine();
        }

        // Token: 0x060000DE RID: 222 RVA: 0x000091A0 File Offset: 0x000081A0
        public void AddEnd(StringBuilder sb)
        {
            StringBuilder stringBuilder = this.current_line[2];
            stringBuilder.Append(sb);
        }

        // Token: 0x060000DF RID: 223 RVA: 0x000091BE File Offset: 0x000081BE
        public void AddEndAndNewLine(StringBuilder sb)
        {
            this.AddEnd(sb);
            this.NewLine();
        }

        // Token: 0x060000E0 RID: 224 RVA: 0x000091D0 File Offset: 0x000081D0
        public void AddStart(string s)
        {
            StringBuilder stringBuilder = this.current_line[0];
            stringBuilder.Append(s);
        }

        // Token: 0x060000E1 RID: 225 RVA: 0x000091EE File Offset: 0x000081EE
        public void AddStartAndNewLine(string s)
        {
            this.AddStart(s);
            this.NewLine();
        }

        // Token: 0x060000E2 RID: 226 RVA: 0x00009200 File Offset: 0x00008200
        public void AddStart(StringBuilder sb)
        {
            StringBuilder stringBuilder = this.current_line[0];
            stringBuilder.Append(sb);
        }

        // Token: 0x060000E3 RID: 227 RVA: 0x0000921E File Offset: 0x0000821E
        public void AddStartAndNewLine(StringBuilder sb)
        {
            this.AddStart(sb);
            this.NewLine();
        }

        // Token: 0x060000E4 RID: 228 RVA: 0x00009230 File Offset: 0x00008230
        public override string ToString()
        {
            StringBuilder stringBuilder = new StringBuilder();
            int[] array = new int[3];
            int[] array2 = array;
            foreach (StringBuilder[] array3 in this.array_format)
            {
                for (int i = 0; i < 3; i += 2)
                {
                    if (array3[i].Length > array2[i])
                    {
                        array2[i] = array3[i].Length;
                    }
                }
            }
            if (array2[0] > 0)
            {
                array2[0]++;
            }
            if (array2[2] > 0)
            {
                array2[2]++;
            }
            int j = this.array_format.Count - 1;
            while (j >= 0 && this.array_format[j][0].Length == 0 && this.array_format[j][1].Length == 0 && this.array_format[j][2].Length == 0)
            {
                j--;
            }
            for (j--; j >= 0; j--)
            {
                if (this.array_format[j][1].Length > array2[1])
                {
                    array2[1] = this.array_format[j][1].Length;
                }
            }
            array2[1]++;
            foreach (StringBuilder[] array4 in this.array_format)
            {
                for (int i = 0; i < 3; i++)
                {
                    stringBuilder.Append(array4[i]);
                    j = array4[i].Length;
                    while (j++ < array2[i])
                    {
                        stringBuilder.Append(" ");
                    }
                }
                stringBuilder.AppendLine("");
            }
            return stringBuilder.ToString();
        }

        // Token: 0x0400018E RID: 398
        private StringBuilder[] current_line;

        // Token: 0x0400018F RID: 399
        private List<StringBuilder[]> array_format;
    }
}